import { ApiCall } from "tsrpc";
import { ReqList, ResList } from "../../../../shared/master/body/pet/PtlList";
import { player } from "../../../../model/fight/body/player";
import { template } from "../../../../shared/master/MsgAction";

export default async function (call: ApiCall<ReqList, ResList>) {
   let user = call.req._player as player;
   const list = user.getPets();
   let res:any = [];
   for (let i = 0; i < list.length; i++) {
      const element = list[i];
      res.push({
         name:element.nickName,
         hp_per:Number((element.Hp_now / element._attributes.Hp_Max).toFixed(2))
      })
   }
   call.succ({list:res});
}